# Contributor: Thomas Liske <thomas@fiasko-nw.net>
# Maintainer: Thomas Liske <thomas@fiasko-nw.net>
pkgname=lcdproc
pkgver=0.5.9
pkgrel=4
pkgdesc="Multi-platform LCD display driver"
url="https://www.lcdproc.org/"
arch="all"
license="GPL-2.0-or-later"
makedepends="ncurses-dev libusb-compat-dev libftdi1-dev lirc-dev linux-headers libpng-dev"
subpackages="$pkgname-doc $pkgname-openrc"
source="https://github.com/lcdproc/lcdproc/releases/download/v0.5.9/lcdproc-$pkgver.tar.gz
	0001-iface.patch
	LCDd.initd
	lcdproc.initd
	"

prepare() {
	default_prepare
	update_config_sub
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc/lcdproc \
		--mandir=/usr/share/man \
		--localstatedir=/var/lib \
		--disable-static \
		--enable-stat-nfs \
		--enable-stat-smbfs \
		--enable-drivers="all,!irman,!svga" \
		--enable-libusb \
		--enable-libusb-1-0 \
		--enable-seamless-hbars \
		--enable-testmenus \
		--enable-permissive-menu-goto \
		--enable-lcdproc-menus

	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install

	sed -i -e 's@DriverPath=.*@DriverPath=/usr/lib/lcdproc/@' "$pkgdir"/etc/lcdproc/LCDd.conf

	# remove lcdproc client examples
	rm -f "$pkgdir"/usr/bin/*.pl

	install -Dm755 "$srcdir"/LCDd.initd "$pkgdir"/etc/init.d/LCDd
	install -Dm755 "$srcdir"/lcdproc.initd "$pkgdir"/etc/init.d/lcdproc
}

sha512sums="
48e11a587570376b9524591f4c23deace9ac1609b83ba9e17f2a4e950d5598f8f88b580ca01c174ec9c2ef98b1eef7ac274c23ca3541d4d7ff918af0598c6a25  lcdproc-0.5.9.tar.gz
f11602a4670f78dcdcabfd56a4c113c6657739df8b6a39a20da01f6fe5d472e2050cc4373c10a8dfa31f62e6015f1f51cc17499344d695777ffcc932271e29df  0001-iface.patch
003220d9600e31cda5f5ddcc55f87d2e58fc4e040d8b32102bd3af623e0550611477f63939ff48e1ddc80db693ff04cd94add2392521a5fdd1dff3831dcbd553  LCDd.initd
67658394273e9861ba15dfd5af70b910cddb4a23e7ae52cfd1ab52003acb5b649cfe4af0dad9a2f529a9e64844b67d04d74dda79cd8e93be3f276260ff356d1b  lcdproc.initd
"
